<template>
  <div class="df jcsa mt10">
    <div class="bt_left">
      <div class="topTitle df aic jcsa">
        <img src="@/assets/government/lnputSupervision/super_7.png" style="width:22px;height:22px" />
        <div class="cf">最近30天</div>
        <img src="@/assets/government/lnputSupervision/super_10.png" style="width:16px;height:10px" />
      </div>
      <div class="lineEcharts mt60" id="lineEcharts"></div>
    </div>
    <div class="bt_left">
      <div class="topTitle df aic jcsa">
        <img src="@/assets/government/lnputSupervision/super_7.png" style="width:22px;height:22px" />
        <div class="cf ml10 mr10">最近30天</div>
        <img src="@/assets/government/lnputSupervision/super_10.png" style="width:16px;height:10px" />
      </div>
      <div class="df aic mt65 ml30 jcsa">
        <div class="topTitleNum df aic">
          <div class="numBox" v-for="(item,index) in 5" :key="index">{{index}}</div>
          <span class="cf fwBlod fs28">个</span>
        </div>
        <img
          src="@/assets/government/lnputSupervision/super_9.png"
          style="width:253px;height:228px"
        />
        <img src="@/assets/government/lnputSupervision/super_4.png" style="width:121px;height:39px" />
        <div class>
          <div class="df aic cf mb20" v-for="(item,index) in proList" :key="index">
            <div class="mr10" style="width:70px">{{item.name}}</div>
            <el-progress
              color="#2BD0E4"
              style="width:220px"
              text-color="#fff"
              :percentage="item.value"
            ></el-progress>
            <div class="lableBox mr10"></div>
            <div class="ml10">{{item.num}}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
  
  <script>
import * as echarts from "echarts";

export default {
  components: {},
  data() {
    return {
      proList: [
        {
          value: 89,
          name: "除草剂",
          num: 34
        },
        {
          value: 84,
          name: "杀虫剂",
          num: 30
        },
        {
          value: 63,
          name: "杀菌剂",
          num: 22
        },
        {
          value: 40,
          name: "杀虫/杀菌",
          num: 12
        },
        {
          value: 26,
          name: "杀鼠剂",
          num: 6
        },
        {
          value: 0,
          name: "调节剂",
          num: 0
        }
      ]
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      var chartDom = document.getElementById("lineEcharts");
      var myChart = echarts.init(chartDom);
      var option;
      option = {
        color: ["#1CC274", "#FE6A00", "#00F6FF", "#FFE400"],
        xAxis: {
          type: "category",
          data: [
            "01-01",
            "01-02",
            "01-03",
            "01-04",
            "01-05",
            "01-06",
            "01-07",
            "01-08",
            "01-09",
            "01-10"
          ],
          axisLabel: {
            color: "white",
            fontSize: 13, // 设置字体大小为 14px，可以根据需要调整
            fontWeight: "bold"
          },
          axisTick: {
            show: false
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: "#FFFFFF"
            }
          }
        },
        grid: {
          top: "10%",
          left: "2%",
          right: "1%",
          bottom: "0%",
          containLabel: true
        },
        legend: {
          data: ["农药", "肥料", "种子", "饲料", "兽药"],
          inactiveColor: "#fff",
          inactiveBorderColor: "#fff",
          textStyle: {
            color: "#fff"
          }
        },
        yAxis: {
          type: "value",
          axisLabel: {
            color: "white",
            fontSize: 14 // 设置字体大小为 14px，可以根据需要调整
          },
          splitLine: {
            show: true,
            lineStyle: {
              color: "#2A8984",
              type: "dashed"
            }
          },
          axisLine: {
            show: false
          }
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
            label: {
              backgroundColor: "#6a7985"
            }
          }
        },
        series: [
          {
            name: "农药",
            type: "line",
            symbolSize: 10,
            symbol: "circle",
            smooth: true,
            itemStyle: {
              normal: {
                color: "#04CDF4",
                barBorderRadius: 0,
                label: {
                  show: true,
                  color: "white",
                  position: "top",
                  formatter: function(p) {
                    return p.value > 0 ? p.value : "";
                  }
                }
              }
            },
            areaStyle: {
              //区域填充样式
              normal: {
                //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                color: new this.$echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: "#04CDF4"
                    },
                    {
                      offset: 1,
                      color: "rgba(0,0,0, 0)"
                    }
                  ],
                  false
                ),
                shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色
                shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
              }
            },

            data: [103, 369, 292, 380, 259, 115, 178, 465, 629, 433, 285, 428]
          },
          {
            name: "肥料",
            type: "line",
            symbolSize: 10,
            symbol: "circle",
            smooth: true,
            itemStyle: {
              normal: {
                color: "#4a97ff",
                barBorderRadius: 0,
                label: {
                  show: true,
                  color: "white",
                  position: "top",
                  formatter: function(p) {
                    return p.value > 0 ? p.value : "";
                  }
                }
              }
            },
            areaStyle: {
              //区域填充样式
              normal: {
                //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                color: new this.$echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: "#4a97ff"
                    },
                    {
                      offset: 1,
                      color: "rgba(0,0,0, 0)"
                    }
                  ],
                  false
                ),
                shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色
                shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
              }
            },

            data: [203, 469, 392, 180, 259, 215, 278, 465, 429, 233]
          },
          {
            name: "种子",
            type: "line",
            symbolSize: 10,
            symbol: "circle",
            smooth: true,
            itemStyle: {
              normal: {
                color: "#FDD362",
                barBorderRadius: 0,
                label: {
                  show: true,
                  color: "white",
                  position: "top",
                  formatter: function(p) {
                    return p.value > 0 ? p.value : "";
                  }
                }
              }
            },
            areaStyle: {
              //区域填充样式
              normal: {
                //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                color: new this.$echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: "#FDD362"
                    },
                    {
                      offset: 1,
                      color: "rgba(0,0,0, 0)"
                    }
                  ],
                  false
                ),
                shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色
                shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
              }
            },

            data: [403, 269, 192, 280, 229, 115, 578, 165, 329, 233]
          },
          {
            name: "饲料",
            type: "line",
            symbolSize: 10,
            symbol: "circle",
            smooth: true,
            itemStyle: {
              normal: {
                color: "#16ffaf",
                barBorderRadius: 0,
                label: {
                  show: true,
                  color: "white",
                  position: "top",
                  formatter: function(p) {
                    return p.value > 0 ? p.value : "";
                  }
                }
              }
            },
            areaStyle: {
              //区域填充样式
              normal: {
                //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                color: new this.$echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: "#16ffaf"
                    },
                    {
                      offset: 1,
                      color: "rgba(0,0,0, 0)"
                    }
                  ],
                  false
                ),
                shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色
                shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
              }
            },

            data: [403, 269, 192, 280, 229, 115, 578, 165, 329, 233]
          },
          {
            name: "兽药",
            type: "line",
            symbolSize: 10,
            symbol: "circle",
            smooth: true,
            itemStyle: {
              normal: {
                color: "#ff0000",
                barBorderRadius: 0,
                label: {
                  show: true,
                  color: "white",
                  position: "top",
                  formatter: function(p) {
                    return p.value > 0 ? p.value : "";
                  }
                }
              }
            },
            areaStyle: {
              //区域填充样式
              normal: {
                //线性渐变，前4个参数分别是x0,y0,x2,y2(范围0~1);相当于图形包围盒中的百分比。如果最后一个参数是‘true’，则该四个值是绝对像素位置。
                color: new this.$echarts.graphic.LinearGradient(
                  0,
                  0,
                  0,
                  1,
                  [
                    {
                      offset: 0,
                      color: "#ff0000"
                    },
                    {
                      offset: 1,
                      color: "rgba(0,0,0, 0)"
                    }
                  ],
                  false
                ),
                shadowColor: "rgba(53,142,215, 0.9)", //阴影颜色
                shadowBlur: 20 //shadowBlur设图形阴影的模糊大小。配合shadowColor,shadowOffsetX/Y, 设置图形的阴影效果。
              }
            },

            data: [103, 369, 492, 380, 129, 115, 278, 465, 229, 433]
          }
        ]
      };

      option && myChart.setOption(option);
    }
  }
};
</script>
  
  <style lang="scss" scoped>
.bt_left {
  width: 921px;
  height: 310px;
  background-image: url(".././../../../assets/government/lnputSupervision/super_5.png");
  background-repeat: no-repeat;
  background-size: 921px;
  position: relative;
  .topTitle {
    width: 150px;
    height: 30px;
    background: linear-gradient(0deg, #0072ff 0%);
    border-radius: 4px;
    padding: 0 6px;
    position: absolute;
    top: 8px;
    right: 20px;
  }
  .topTitleNum {
    position: absolute;
    top: 6px;
    right: 40%;
    .numBox {
      font-family: Source Han Sans CN;
      font-weight: bold;
      font-size: 28px;
      color: #ffffff;
      text-align: center;
      line-height: 30px;
      width: 28px;
      height: 30px;
      background: #0072ff;
      border-radius: 4px;
      margin-right: 5px;
    }
  }
}

.lineEcharts {
  width: 920px;
  height: 240px;
}
.lableBox {
  width: 4px;
  height: 16px;
  background: #00f6ff;
  border-radius: 2px;
}
</style>
  